<?php

/**
 * Coupon form base class.
 *
 * @package    form
 * @subpackage coupon
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseCouponForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'coupon_id'   => new sfWidgetFormInputHidden(),
      'shop_id'     => new sfWidgetFormDoctrineChoice(array('model' => 'Shop', 'add_empty' => false)),
      'offer'       => new sfWidgetFormTextarea(),
      'condition'   => new sfWidgetFormTextarea(),
      'expire_date' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'coupon_id'   => new sfValidatorDoctrineChoice(array('model' => 'Coupon', 'column' => 'coupon_id', 'required' => false)),
      'shop_id'     => new sfValidatorDoctrineChoice(array('model' => 'Shop')),
      'offer'       => new sfValidatorString(array('required' => false)),
      'condition'   => new sfValidatorString(array('required' => false)),
      'expire_date' => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('coupon[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Coupon';
  }

}
